<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/static/crm/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/crm/css/public.css" media="all">
    <title>Document</title>
</head>

<body>
    <form class="layui-form" action="">
        <div class="layui-form layuimini-form">
            <fieldset class="table-search-fieldset" style="border: 3px solid rgb(75, 75, 75);">
                <legend style="color: rgb(75, 75, 75);">基本信息</legend>
                {volist name = '$list' id = 'list'}
                <div class="layui-form-item">
                    <label class="layui-form-label ">名称：</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" value="{$list.name}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">电话：</label>
                    <div class="layui-input-block">
                        <input type="text" name="landline" value="{$list.landline}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">手机：</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" lay-verify="required" value="{$list.phone}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">级别：</label>
                    <div class="layui-input-block">
                        <select name="grade" lay-ignore>
                            <option value="普通客户" {if $list.grade=='普通客户' } selected {/if}>普通客户</option>
                            <option value="重点客户" {if $list.grade=='重点客户' } selected {/if}>重点客户</option>
                            <option value="优质客户" {if $list.grade=='优质客户' } selected {/if}>优质客户</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">行业：</label>
                    <div class="layui-input-block">
                        <select name="industry" lay-ignore>
                            <option value="其他" {if $list.industry=='其他' } selected {/if}>其他</option>
                            <option value="房地产" {if $list.industry=='房地产' } selected {/if}>房地产</option>
                            <option value="金融业" {if $list.industry=='金融业' } selected {/if}>金融业</option>
                            <option value="商业服务" {if $list.industry=='商业服务' } selected {/if}>商业服务</option>
                            <option value="贸易" {if $list.industry=='贸易' } selected {/if}>贸易</option>
                            <option value="运输物流" {if $list.industry=='运输物流' } selected {/if}>运输物流</option>
                            <option value="服务业" {if $list.industry=='服务业' } selected {/if}>服务业</option>
                            <option value="文化传媒" {if $list.industry=='文化传媒' } selected {/if}>文化传媒</option>
                            <option value="IT/互联网" {if $list.industry=='IT/互联网' } selected {/if}>IT/互联网</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">来源：</label>
                    <div class="layui-input-block">
                        <select name="source" lay-ignore>
                            <option value="个人资源" {if $list.source=='个人资源' } selected {/if}>个人资源</option>
                            <option value="广告" {if $list.source=='广告' } selected {/if}>广告</option>
                            <option value="转介绍" {if $list.source=='转介绍' } selected {/if}>转介绍</option>
                            <option value="搜索引擎" {if $list.source=='搜索引擎' } selected {/if}>搜索引擎</option>
                            <option value="公司资源" {if $list.source=='公司资源' } selected {/if}>公司资源</option>
                            <option value="电话咨询" {if $list.source=='电话咨询' } selected {/if}>电话咨询</option>
                            <option value="官网咨询" {if $list.source=='官网咨询' } selected {/if}>官网咨询</option>
                            <option value="公众号" {if $list.source=='公众号' } selected {/if}>公众号</option>
                            <option value="抖音" {if $list.source=='抖音' } selected {/if}>抖音</option>
                            <option value="企业微信" {if $list.source=='企业微信' } selected {/if}>企业微信</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label ">标签：</label>
                    <div class="layui-input-block">
                        <input type="text" name="label" value="{$list.label}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">地址：</label>
                    <div class="layui-input-block">
                        <input type="text" name="address" value="{$list.address}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">详细地址：</label>
                    <div class="layui-input-block">
                        <input type="text" name="detailed" value="{$list.detailed}" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">下次跟进时间：</label>
                    <div class="layui-input-inline">
                        <input name="follow_time" value="{$list.follow_time}" type="text" class="layui-input"
                            id="test12" placeholder="">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注：</label>
                    <div class="layui-input-block">
                        <textarea name="remark" class="layui-textarea" placeholder="">{$list.remark}</textarea>
                    </div>
                </div>
                {/volist}
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </fieldset>
        </div>
    </form>
</body>

</html>
<script src="/static/crm/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'laydate', 'jquery'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate,
            $ = layui.jquery;

        laydate.render({
            elem: '#test12'
        });

        form.on('submit(formDemo)', function (data) {
            $.ajax({
                url: 'amend',
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (data) {
                    if (data.code == 1) {
                        layer.msg(data.msg,{
                            time:1500,
                            end: function(){
                                var iframeIndex = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(iframeIndex);
                            }
                        });
                        
                    } else if (data.code == 0){
                        layer.msg(data.msg);
                    }
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

    });
</script>